<%@ page contentType="text/html; charset=utf-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>爱购物-商城 - 首页</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/static/css/style.css"/>
</head>
<body>
<c:import url="/front/header"/>
<div id="position" class="wrap">
    您现在的位置：<a href="${pageContext.request.contextPath}/index">爱购物-商城</a> &gt; 购物车
</div>
<div class="wrap">
    <div id="shopping">
        <form action="${pageContext.request.contextPath}/order/add" method="post">
            <table>
                <tr>
                    <th>商品名称</th>
                    <th>商品价格</th>
                    <th>购买数量</th>
                    <th>操作</th>
                </tr>
                <c:forEach var="rs" items="${shops}">

                    <tr id="product_id_1">
                        <td class="thumb">
                            <input type="checkbox" name="op" onclick="dxcheck()" value="${rs.id}"/>
                            <img src="${pageContext.request.contextPath}${rs.product.fileName }" height="100" width="100"/>
                            <a href="${pageContext.request.contextPath}/product?id=${rs.productId}">${rs.product.name }</a>
                        </td>
                        <td class="price" id="price_id_1">
                            <span id="priceText" name="priceText">${rs.product.price}</span>
                            <!-- 商品单价 --><input type="hidden" name="sPPrice" value="${rs.product.price}"/>
                        </td>
                        <td class="number">
                            <dl>
                                <dt>
                                    <input type="button" value="-" onclick="sub(${rs.id})"/>
                                    <!-- 购物单id -->
                                    <input type="hidden" name="esID" value="${rs.id}"/>
                                    <!-- 商品id -->
                                    <input type="hidden" name="spID" value="${rs.productId}"/>
                                    <!-- 购买数量
                                        onblur:失去焦点时出发，直接修改数量
                                     -->
                                    <input id="${rs.id}" type="text" name="number"
                                                value="${rs.productQuantity }"
                                                onblur="closeText(id,${rs.product.stock})"/>
                                    <input type="button" value="+" onclick="plus(${rs.id},${rs.product.stock}) "/>
                                </dt>

                            </dl>
                        </td>
                        <td class="delete"><a href="javascript:del(${rs.id});">删除</a></td>
                    </tr>
                </c:forEach>
            </table>
            <input type="checkbox" onclick="qxcheck()" name="op2"/>全选
            <div align="right">总价钱:<span id="zdzj">0</span>元</div>
            <input type="hidden" name="jstext" id="jstext" value="0"/>
            <div align="center"><span id="xzText">请选择物品！！！</span></div>
            <div class="button"><input style="display:none;" type="submit" value="" id="jsbutton"/></div>
        </form>
    </div>
    <script type="text/javascript">
        // document.write("Cookie中记录的购物车商品ID：" + getCookie("product") + "，可以在动态页面中进行读取");
    </script>
</div>
<c:import url="/static/page/footer.jsp"/>
</body>
</html>
<script src="${pageContext.request.contextPath}/static/js/shopping.js"></script>
